home *** CD-ROM | disk | FTP | other *** search
- // globals
- // window arguments defined here, but may not be used.
- // mainly to test & explain valid arguments.
-
- /**
- var invitedScreenNames = window.arguments[0]
- var inviteToExistingWindow=window.arguments[1]
- var inviteMode=window.arguments[2]
- var inviteProposalObj=window.arguments[3]
- **/
-
- inviteArgsObj = window.arguments[0];
-
- invitedScreenNames = inviteArgsObj.invitedScreenNames;
- inviteToExistingWindow = inviteArgsObj.inviteToExistingWindow;
- inviteMode = inviteArgsObj.inviteMode;
-
- inviteProposalObj=inviteArgsObj.inviteProposalObj;
- inviteProposalScreenName = inviteArgsObj.inviteProposalScreenName;
- inviteToExistingRoom = inviteArgsObj.inviteToExistingRoom;
-
-
- // for incoming chat invitation
- var incomingChatScreenName = inviteProposalScreenName;
- var incomingChatWarningLevel;
- var incomingChatRoomName;
- var incomingChatRoomDate;
- var incomingChatRoomInviteMsg;
- var incomingChatRoom;
-
- var ChatManagerCallBack = new Object();
- var RoomCreationTimeStamp = null;
-
- ChatManagerCallBack.OnRequestRoomComplete = function(roomName,chatRoomObj){
- dump("before doing GetName\n");
- incomingChatRoom=chatRoomObj;
- incomingChatRoomName = chatRoomObj.GetName();
- dump("OnRequestRoomComplete " + incomingChatRoomName + "\n");
- document.getElementById("chatRendezvousRoomName001").setAttribute("value",incomingChatRoomName);
- // document.getElementById("chatRendezvousRoomName001").value=incomingChatRoomName;
- dump("leaving onrequestroomcomplete\n");
- }
-
-
- ChatManagerCallBack.OnRequestRoomError = function(roomName,errMsg){
- dump("OnRequestRoomError: there was an error \n");
-
- }
-
-
- myExecutionCallback = new Object();
- myExecutionCallback.ExecuteIfReady = function()
- {
- // get chatroom and callbacks
- dump ("executeifready\n");
- inviteProposalObj.Accept();
- aimChatManager().RequestProposedRoom(ChatManagerCallBack, inviteProposalObj);
- }
-
- function chatInviteBuddyOnWinLoad(){
-
- /* VISHY - this is a performance optimization.
- Since chat needs time to get ready, this tells it to
- get ready, well before we actually use it */
- aimChatManager().ExecuteIfReady(null);
-
- dump("chatInviteBuddyOnWinLoad\n");
-
- if(inviteMode && inviteMode=="incomingchat"){
- dump("incoming chat\n");
- document.getElementById("cibdeck001").setAttribute("index",2)
-
- //incomingChatScreenName = "testscreename";
- incomingChatWarningLevel = " " + aimString("chat.WarningLevel").replace(/%Level%/, inviteProposalObj.GetProposer().GetWarningPercent());
- incomingChatRoomName = " ";
- incomingChatRoomDate= new Date();
- incomingChatRoomInviteMsg = inviteProposalObj.GetInvitation();
- dump("Invite Msg is " + incomingChatRoomInviteMsg + "\n");
- document.getElementById("chatRendezvousScreenName001").setAttribute("value",incomingChatScreenName);
- // document.getElementById("chatRendezvousScreenName001").value=incomingChatScreenName;
- document.getElementById("chatRendezvousScreenName002").setAttribute("value",incomingChatScreenName);
- // document.getElementById("chatRendezvousScreenName002").value=incomingChatScreenName;
- document.getElementById("chatRendezvousWarningLevel001").setAttribute("value",incomingChatWarningLevel);
- // document.getElementById("chatRendezvousWarningLevel001").value=incomingChatWarningLevel;
- document.getElementById("chatRendezvousRoomName001").setAttribute("value",incomingChatRoomName);
- // document.getElementById("chatRendezvousRoomName001").value=incomingChatRoomName;
- document.getElementById("chatRendezvousChatRoomDate").setAttribute("value",incomingChatRoomDate);
- // document.getElementById("chatRendezvousChatRoomDate").value=incomingChatRoomDate;
- document.getElementById("chatRendezvousInvitationMsg").setAttribute("value", incomingChatRoomInviteMsg);
- // document.getElementById("chatRendezvousInvitationMsg").value= incomingChatRoomInviteMsg;
-
- //XXXVISHY - unfortunately you need to get the Chat Room
- // in order to find its name ;-)
- dump("About to call ExecuteIfReady\n");
- aimChatManager().ExecuteIfReady(myExecutionCallback);
-
- }
-
- if(inviteMode && inviteMode=="outgoingchat"){
- dump("outgoing chat\n");
- document.getElementById("cibdeck001").setAttribute("index",1)
- //alert(document.getElementById("cibdeck001"))
-
- dump('ChatInviteBuddy: Loading \n')
-
- if(window.arguments[0]){
-
- dump('ChatInviteBuddy:screenNames: '+invitedScreenNames+'\n');
- }
- else{
- invitedScreenNames = "";
- dump('ChatInviteBuddy:no pre invited screenNames: '+invitedScreenNames+'\n');
-
- }
-
- // document.getElementById("invitedscreennames").setAttribute("value",invitedScreenNames);
-
- document.getElementById("invitedscreennames").value=invitedScreenNames;
-
- // document.getElementById("invitationmsg").setAttribute("value","Join me in this Buddy Chat")
- // document.getElementById("invitationmsg").value="Join me in this Buddy Chat";
-
- dump("cib:setting invite msg: \n");
- //document.getElementById("invitationmsg")["value"]="Join me in this Buddy Chat"
- document.getElementById("invitationmsg").value=aimString("chat.JoinMe");
- // document.getElementById("invitationmsg").setAttribute("value", aimString("chat.JoinMe"));
-
-
-
- if(inviteToExistingWindow){
- dump("inviteToExisting window\n");
- document.getElementById("buddychatroomname").setAttribute("disabled","true");
- document.getElementById("buddychatroomname").value = inviteToExistingRoom;
- // document.getElementById("buddychatroomname").setAttribute("value", inviteToExistingRoom);
- }
- else
- chatPreFillRoomName();
-
- document.getElementById("invitedscreennames").focus();
-
-
-
-
-
- }
-
- }
-
-
- function chatInviteBuddyOnWinUnLoad(){
- //window.close();
- }
-
- function chatInviteBuddyCmdInvite(){
- dump("chatInviteBuddyCmdIncite\n");
- document.getElementById("cibdeck001").setAttribute("index",3)
-
- //document.getElementById("cibdeck").setAttribute("id",1);
- if(!inviteToExistingWindow){
- // var invitedScreenNames = document.getElementById("invitedscreennames").getAttribute("value");
- var invitedScreenNames = document.getElementById("invitedscreennames").value;
- // var chatRoomName = document.getElementById("buddychatroomname").getAttribute("value");
- var chatRoomName = document.getElementById("buddychatroomname").value;
- dump("setting ChatRoomName "+chatRoomName+"\n")
- // var chatMsg = document.getElementById("invitationmsg").getAttribute("value");
- var chatMsg = document.getElementById("invitationmsg").value;
- dump("screenNames "+invitedScreenNames+"\n");
-
- // just send one argument to window.openDialog - but build an object. This way you dont have to worry about
- // keeping track of the argument's order.
- chatContentArgs = new Object();
- chatContentArgs.invitedScreenNames = invitedScreenNames;
- chatContentArgs.chatRoomName = chatRoomName;
- chatContentArgs.chatMsg = chatMsg;
- // not incoming chat
- chatContentArgs.incomingChat = false;
- chatContentArgs.incomingChatInviteProposalScreenName = ''
- chatContentArgs.incomingChatInviteProposalObj=null
- chatContentArgs.incomingChatRoom=null;
- dump("about to openDialog chatContent.xul\n");
- window.openDialog("chrome://aim/content/chatContent.xul","","chrome,all,dialog=no",chatContentArgs);
-
-
- //window.close();
-
- }
- else{
- dump("myOpener:"+window.opener+"\n")
- // window.opener.chatContentInviteMany(document.getElementById("invitedscreennames").getAttribute("value"),document.getElementById("invitationmsg").getAttribute("value"))
- window.opener.chatContentInviteMany(document.getElementById("invitedscreennames").value,document.getElementById("invitationmsg").value);
- // window.opener.chatMsg = document.getElementById("invitationmsg").getAttribute("value")
- window.opener.chatMsg = document.getElementById("invitationmsg").value;
- window.close();
- }
-
- }
-
- function cmdChatIncomingWarn()
- {
- var warnUserArgs = new Object();
- warnUserArgs.screenName = incomingChatScreenName;
-
- window.openDialog("chrome://aim/content/WarnUser.xul","_blank", "chrome,dialog=no",warnUserArgs)
- }
-
- function cmdChatIncomingBlock()
- {
- var answer = top.confirm( aimString("confirm.BlockUser").replace(/%ScreenName%/, incomingChatScreenName) );
- if ( answer == false )
- return;
- aimPrivacy().DenyListAdd( incomingChatscreenName );
- aimPrivacy().PrivacyMode = aimPrivacyModes().DenyList;
- }
-
- function cmdChatIncomingIM()
- {
- aimIMInvokeIMForm(incomingChatScreenName, null);
- }
-
- function cmdChatIncomingInfo()
- {
-
- }
-
- function chatInviteBuddyCmdDeclineRendezvous()
- {
- inviteProposalObj.Reject();
- window.close();
- }
-
- function chatInviteBuddyCmdAcceptRendezvous(){
- document.getElementById("cibdeck001").setAttribute("index",3)
-
-
- // code to accept rendezvous here
- var invitedScreenNames = "";
- var chatRoomName=incomingChatRoomName
- var chatMsg = "";
-
-
- // just send one argument to window.openDialog - but build an object. This way you dont have to worry about
- // keeping track of the argument's order.
- chatContentArgs = new Object();
- chatContentArgs.invitedScreenNames = invitedScreenNames;
- chatContentArgs.chatRoomName = chatRoomName;
- chatContentArgs.chatMsg = chatMsg;
- dump('chatInviteBuddy.js :try to accept the proposal \n');
- //inviteProposalObj.Accept();
- // yes incoming chat
- chatContentArgs.incomingChat = true;
- chatContentArgs.incomingChatInviteProposalScreenName = inviteProposalScreenName;
- chatContentArgs.incomingChatInviteProposalObj=inviteProposalObj
- chatContentArgs.incomingChatRoom=incomingChatRoom;
- window.openDialog("chrome://aim/content/chatContent.xul","","chrome,all,dialog=no",chatContentArgs);
-
-
- }
-
-
- function chatPreFillRoomName(){
- if(pIIMManager){
- // depends on AimSession.js
- var currentScreenName = aimSessionCurrentScreenName()
- //does this need to be instead 001 , 002, 003 ?
- var someRandomNumber = Math.ceil(Math.random()*100);
- // document.getElementById("buddychatroomname").setAttribute("value",currentScreenName+" chat "+someRandomNumber);
- document.getElementById("buddychatroomname").value=currentScreenName+" chat "+someRandomNumber;
-
- }
-
- }
-